package test3;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class Day2 {
    public static void main(String[] args) throws ParseException {
        String[] weekDays = {"星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
        String str = "2024-01-06";
        SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        Date newDate = sd.parse(str);
        calendar.setTime(newDate);
        int w = calendar.get(Calendar.DAY_OF_WEEK) - 1;

        System.out.println(newDate);
        if (w < 0){
            w = 0;
        System.out.println(weekDays[w]);
    }else{
            System.out.println(weekDays[w]);
        }


    }
}
